﻿using System;
using Devv.Core.Utils;

namespace Devv.FreshTracker.Entity
{
	[Serializable]
	public class Rule
	{
		#region Properties

		public Boolean Enabled { get; set; }
		public String WindowTitle { get; set; }
		public Task Task { get; set; }

		public String TaskTitle
		{
			get { return Task.FullDisplayMember; }
		}

		public String Code
		{
			get { return GetCode(WindowTitle); }
		}

		#endregion

		#region Constructor

		public Rule()
		{
			Task = new Task();
		}

		#endregion

		#region Helper methods

		public static String GetCode(String title)
		{
			return RegexUtil.RemoveSpecialCharacters(title, false);
		}

		#endregion

		#region ToString

		public override String ToString()
		{
			return WindowTitle;
		}

		#endregion
	}
}